# -*- coding: UTF-8 -*-
import os
import os.path
import sys
current_dir = os.path.abspath(os.path.dirname(__file__))
sys.path.append(current_dir)
sys.path.append("..")

import genYAML
import case
import time
import ruamel.yaml as yaml
import os
from file_method import Location_Sample
# setting loading
# with open("./setting/total_set.yaml", 'r+') as f:
#     temp_dic = yaml.load(f.read(), Loader=yaml.Loader)
# #
def Gen_Total_Yaml(temp_dic):
    local_time = time.asctime(time.localtime(time.time()))  # 当前时间
    # format_time=time.strftime("%Y-%m-%d_%H:%M:%S")
    format_time = time.strftime("%Y-%m-%d_%H_%M_%S")
    name=temp_dic['name']
    descrpition=temp_dic['descrption']
    status=temp_dic['status']
    # file_path=temp_dic['file_path']   #"/home/versirity/program_all/latest_project/testHarness/s_yaml"
    # case_path=temp_dic['case_path'] #"/home/versirity/program_all/latest_project/testHarness/total_yaml/dd.yaml"
    # file_path=Location_Sample.win_to_ubuntu_filepath(temp_dic['file_path'],'Src_Code')
    # case_path=Location_Sample.win_to_ubuntu_filepath(temp_dic['case_path'],'Src_Code')
    case_path = temp_dic['case_path']
    if not case_path:
        os.mkdir(case_path)
    tmp_name=("%s_%s.yaml"%('-'.join(format_time.split()),'-'.join(name.split())))
    case_path=case_path+"/"+tmp_name
    file_path=temp_dic['path_load']
    genYAML.genCollectionYaml(case_path,descrpition,status,file_path,name)
    return (tmp_name,case_path)
